import request from "@/utils/request";

// 创建策略
export function strategyCreatApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategy/create',
        method: 'post',
        data
    });
};
// 查询策略组列表
export function groupPolicyListApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategyGroup/getStrategyGroupByPage',
        method: 'post',
        data
    });
};




export function createSceneApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategy/createScene',
        method: 'post',
        data
    });
};


// 创建/修改策略时 获取场景列表
export function getSceneListApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategy/getSceneList',
        method: 'post',
        data
    });
};
//查询策略列表
export function getStrategyApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategy/getStrategyByPage',
        method: 'post',
        data
    });
};

// 修改策略的状态 启用/暂停
export function policyEditApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategy/edit',
        method: 'post',
        data
    });
};




export function policyDeleteApi1 (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategy/delete',
        method: 'post',
        data
    });
};
// 删除策略（逻辑删）
export function policyDeleteApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategy/deleteLogic',
        method: 'post',
        data
    });
};
// 删除策略组
export function policyGroupDeleteApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategyGroup/delete',
        method: 'post',
        data
    });
};



// 创建策略组
export function groupPolicyCreateApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategyGroup/create',
        method: 'post',
        data
    });
};
// 编辑策略组
export function editStrategyGroupApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategyGroup/edit',
        method: 'post',
        data
    });
};



// 创建/修改策略组时候， 获取 之前已经创建的trigger ，根据部门和场景组合的树结构的策略组
export function getStrategyByGroupApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategy/getStrategyByGroup',
        method: 'post',
        data
    });
};


// 选中对应的tree节点，获取其下面的所有trigger列表
export function getStrategyByIdsApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategy/getStrategyByIds',
        method: 'post',
        data
    });
};




// 历史配置查询 
export function getHistoryConfigApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategyConfig/getHistoryStrategyConfigByPage',
        method: 'post',
        data
    });
};
// 历史配置的详情 
export function getHistoryConfigDetailApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategyConfig/getHistoryConfigDetail',
        method: 'post',
        data
    });
};

//回滚历史配置
export function rollbackHistoryConfigApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategyConfig/rollbackHistoryConfig',
        method: 'post',
        data
    });
};
// 查询操作记录
export function operationHistoryApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategy/operation/history/selectByPage',
        method: 'post',
        data
    });
};
// 点击策略组条目展开，显示详细trigger列表
export function getStrategyPageByStrategyGroupIdApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategy/getStrategyPageByStrategyGroupId',
        method: 'post',
        data
    });
};
// 当前策略组涉及车辆的 历史配置 车辆列表 （前端代码中有用，不过接口500）
export function getRelationCarPageByStrategyConfigIdApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategyConfig/getRelationCarPageByStrategyConfigId',
        method: 'post',
        data
    });
};
// 当前策略组涉及车辆的 当前生效 车辆列表
export function getCurrentCarPageByStrategyConfigIdApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategyConfig/getCurrentCarPageByStrategyConfigId',
        method: 'post',
        data
    });
};
// 策略组的涉及车辆
export function getStrategyConfigListByGroupIdApi (data) {
    return request({
        apiType:'CAR',
        requestBaseUrl:'carmanage',
        url: '/web/strategyConfig/getStrategyConfigListByGroupId',
        method: 'post',
        data
    });
};